package com.summer.JUnit;

import junit.extensions.TestSetup;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

public class TestClassTwo extends TestCase {

	private static TSP tsp;
	
	public TestClassTwo(String method){
		super(method);
	}
	
	public void testLongRunner(){
//		TSP tsp = new TSP();
		assertEquals(2300, tsp.shortestPath(50));
	}
	
	public void testShortTest(){
//		TSP tsp = new TSP();
		assertEquals(140, tsp.shortestPath(5));
	}
	
	public void testAnotherShortTest(){
//		TSP tsp = new TSP();
		assertEquals(586, tsp.shortestPath(10));
	}
	
	public static Test suite(){
		TestSuite suite = new TestSuite();
		//Only include short tests
		suite.addTest(new TestClassTwo("testShortTest"));
		suite.addTest(new TestClassTwo("testAnotherShortTest"));
		
		TestSetup testSetup = new TestSetup(suite){

			@Override
			protected void setUp() throws Exception {
				oneTimeSetUp();
			}

			@Override
			protected void tearDown() throws Exception {
				oneTimeTearDown();
			}
			
		};
		
		return testSetup;
	}
	
	public static void oneTimeSetUp(){
		tsp = new TSP();
		System.out.println("loading eastern seaboard");
	}
	
	public static void oneTimeTearDown(){
		System.out.println("release");
	}
	
}
